package cn.itcast.order.web;




import cn.itcast.feign.client.UserClient;
import cn.itcast.feign.pojo.User;
import cn.itcast.order.pojo.Order;
import cn.itcast.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

   @Autowired
   private OrderService orderService;


    @GetMapping("{orderId}")
    public Order queryOrderByUserId(@PathVariable("orderId") Long orderId) {
        Order order = orderService.queryOrderById(orderId);
        // 根据id查询订单并返回
        return order;
    }
    @Autowired
    private UserClient userClient;

    @GetMapping("save")
    public String save(){
        User user = new User();
        user.setId(12l);
        user.setUsername("zhangsan");
        user.setAddress("");
        String insert = userClient.save(user);
        return insert;
    }
}
